package com.mine.modules.vm.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mine.common.domain.query.PageQuery;
import com.mine.common.domain.vo.Result;
import com.mine.modules.vm.domain.dto.VmLayerDto;
import com.mine.modules.vm.domain.query.AssetsPageQuery;
import com.mine.modules.vm.entity.VmAssets;
import com.mine.modules.vm.entity.VmScene;
import com.mine.modules.vm.service.IVmSceneService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 场景菜单 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-10-23
 */
@RestController
@Api(tags = "场景管理")
@RequestMapping("/vm/scene")
@RequiredArgsConstructor
public class VmSceneController {

    private final IVmSceneService vmSceneService;

    @ApiOperation(value = "分页获取场景列表", notes = "分页获取设备列表")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public Result<?> queryPageList(PageQuery pageQuery) {
        return vmSceneService.queryPageList(pageQuery);
    }

    @ApiOperation(value = "添加或修改场景", notes = "添加或修改场景")
    @PostMapping(value = "/addOrEdit")
    public Result<?> addOrEdit(VmScene vmScene) {
        return vmSceneService.addOrEdit(vmScene);
    }

    @ApiOperation(value = "删除场景", notes = "删除场景")
    @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
        return vmSceneService.delete(id);
    }

    @ApiOperation(value = "批量删除场景", notes = "批量删除场景")
    @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE)
    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        return vmSceneService.deleteBatch(ids);
    }

}
